package com.douqu.game.core.e;

import com.douqu.game.core.protobuf.SGCommonProto;

/**
 * Created by bean on 2017/9/15.
 */
public enum E_BattleDetailType implements BaseEnum {

    PVP_AI_ARENA(1,"竞技场"),
    PVP_AI_OFFICIAL_RANK(2, "官阶战PVP"),
    PVP_AI_MAJOR(3, "专业战"),
    PVE_INSTANCE(4, "副本"),
    PVE_OFFICIAL_RANK(5, "官阶战PVE"),
    PVE_HERO_TEMPLE(6, "英雄圣殿"),
    PVE_EXPEDITION(7, "远征"),
    PVE_WORLD_BOSS(8, "世界BOSS战"),

    PVE_SPAN_CAMP(9, "跨服阵营战PVE"),
    PVP_SPAN_CAMP(10, "跨服阵营战PVP"),
    PVP_DATA_SPAN_CAMP(11, "跨服阵营战PVP_DATA"),

    PVP_DATA_WORLD_MAP(12, "大地图玩家AI"),
    PVP_WORLD_MAP(13, "大地图真人PVP"),
    PVE_WORLD_MAP(14, "大地图PVE"),

    DATA_WORLD_MAP_PVP(15, "数据战-玩家对玩家"),
    DATA_WORLD_MAP_PVE(16, "数据战-玩家对远征军"),
    DATA_WORLD_MAP_PVG(17, "数据战-玩家对驻军"),
    DATA_WORLD_MAP_EVG(18, "数据战-远征军对驻军"),
    DATA_WORLD_MAP_EVE(19, "数据战-远征军对远征军"),

    DATA_WORLD_MAP_DIRECT_END(20, "大地图直接结算")

    ;

    int code;

    String msg;

    E_BattleDetailType(int code, String msg)
    {
        this.code = code;
        this.msg = msg;
    }

    public int getBattleType()
    {
        switch (this)
        {
            case PVP_AI_ARENA:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_ARENA_VALUE;
            case PVP_AI_OFFICIAL_RANK:
            case PVE_OFFICIAL_RANK:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_OFFICIAL_RANK_VALUE;
            case PVP_AI_MAJOR:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_MAJOR_VALUE;
            case PVE_INSTANCE:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_INSTANCE_VALUE;
            case PVE_HERO_TEMPLE:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_HERO_TEMPLE_VALUE;
            case PVE_EXPEDITION:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_EXPEDITION_VALUE;
            case PVE_WORLD_BOSS:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_WORLD_BOSS_VALUE;
            case PVP_SPAN_CAMP:
            case PVE_SPAN_CAMP:
            case PVP_DATA_SPAN_CAMP:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_SPAN_CAMP_VALUE;
            case PVP_WORLD_MAP:
            case PVE_WORLD_MAP:
            case PVP_DATA_WORLD_MAP:
            case DATA_WORLD_MAP_PVP:
            case DATA_WORLD_MAP_PVE:
            case DATA_WORLD_MAP_PVG:
            case DATA_WORLD_MAP_EVE:
            case DATA_WORLD_MAP_EVG:
            case DATA_WORLD_MAP_DIRECT_END:
                return SGCommonProto.E_BATTLE_TYPE.BATTLE_TYPE_WORLD_MAP_VALUE;
        }
        return 0;
    }


    @Override
    public int getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    public boolean isBothPlayer()
    {
        return code == PVP_SPAN_CAMP.getCode() || code == PVP_WORLD_MAP.getCode();
    }

    /**
     * 是否是玩家参与的战斗(有客户端参与)
     * @return
     */
    public boolean isPlayerBattle()
    {
        switch (this)
        {
            case DATA_WORLD_MAP_PVP:
            case DATA_WORLD_MAP_PVE:
            case DATA_WORLD_MAP_PVG:
            case DATA_WORLD_MAP_EVE:
            case DATA_WORLD_MAP_EVG:
                return false;
            default:
                return true;
        }
    }




    public static E_BattleDetailType forNumber(int code)
    {
        for(E_BattleDetailType battleDetailType : values())
        {
            if(battleDetailType.getCode() == code)
                return battleDetailType;
        }

        return null;
    }


}
